﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Business;


namespace GestorEventos
{
    public partial class removeArtistaEvento : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.QueryString["eventID"] != null) {
                int eventID = Convert.ToInt32(Request.QueryString["eventID"].ToString());

                ListaArtista business = new ListaArtista();

                ListaArtista listaArtistas = new ListaArtista(business.getArtistasEvento(eventID));

                for (int i = 0; i < listaArtistas.getListaArtistas().Count; i++) {
                    DropDownListArtistas.Items.Add(listaArtistas.getListaArtistas()[i].getNomeArtista());
                }


            
            }

        }

        public void removerArtista(Object o, EventArgs e)
        {


            if (Request.QueryString["eventID"] != null)
            {
                int eventID = Convert.ToInt32(Request.QueryString["eventID"].ToString());

                String nome = DropDownListArtistas.SelectedValue;

                ListaArtista business = new ListaArtista();
                ListaArtista listaArtista = new ListaArtista(business.getArtistasEvento(eventID));

                int artistaID = listaArtista.getArtistaIDByNome(nome);


                
                Evento evento = new Evento();

                bool value = evento.removeArtistEvent(eventID, artistaID);

                //bool value = evento.insertArtistEvent(eventID, artistaID, data);

               
                if (value) {
                    Label1.Text = "Cenassona";
                }
                if (!value) {
                    Label1.Text = "FAILZAO";
                }

            }
        }


    }
}
